/**
 *	The NeuroCoSA Toolkit
 *	Copyright (C) 2003-6 Stuart Meikle.
 *
 *	This is free software; you can redistribute it and/or
 *	modify it under the terms of the GNU Lesser General Public
 *	License as published by the Free Software Foundation; either
 *	version 2.1 of the License, or (at your option) any later version.
 *
 *	This library is distributed in the hope that it will be useful,
 *	but WITHOUT ANY WARRANTY; without even the implied warranty of
 *	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *	Lesser General Public License for more details.
 *
 * @author	Stuart Meikle
 * @version	2006-halloween(mk2)
 * @license	LGPL
 */
package org.stumeikle.NeuroCoSA;


/** a special type of vesicle which includes an integer key value
 */
public class IntVesicle extends Vesicle implements KeyVesicleIF
{
	protected	int	iKey;	
	public final static int undefined = Integer.MIN_VALUE;

	public IntVesicle()
	{
	    iKey=undefined;
	}
	public IntVesicle(int t)
	{
	    super(t);
	}
	public IntVesicle(int t, int v)
	{
	    super(t);
	    iKey=v;
	}

	public void	setKey(int k)
 	{
	    iKey=k;
	}
	public int	getKey()
	{ return iKey; }

	//implement the if
	public boolean	matches( KeyVesicleIF b )
	{
	    IntVesicle	iv;

	    try
	    {
		iv = (IntVesicle) b; 
	        if (iv.getKey() == iKey)	return	true;
	        return false;
	    } catch(Exception e)
	    {}
	
	    return false;
	}
}

